package com.xzy.demo.dao;

import com.xzy.demo.entry.Staff;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface StaffRepository extends JpaRepository<Staff,Integer> {

    @Query(value = "update f_staff set name = ?1,password = ?2 where id = ?3 ",nativeQuery = true)
    @Modifying
    int updateStaff(String name,String password,Integer id);

    @Query(" from Staff u where u.name=:userName")
    Staff getStaffByName(@Param("userName") String name);

}
